<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>tl-ops-manage后台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <script src="../lib/axios.js"></script>
    <script src="../lib/layui/layui.js" v="layui" e="layui"></script>
    <link rel="stylesheet" type="text/css" href="../lib/layui/css/layui.css" />
</head>
<style>
    input {
        color: darkorchid;
        font-weight: 700;
    }
</style>
<body>
    <div class="layui-fluid" style="padding: 20px;">
        <div class="layui-card">
            <div class="layui-card-body">
                <script id="tl-ops-web-store-tpl" type="text/html">
                {{#  if(d.length === 0) { }}
                <p style="line-height: 37px;">暂无历史数据</p>
                {{#  } else { }}
                {{#  layui.each(d, function(index, item){ }}
                <ul class="layui-timeline">
                    <li class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                        <div class="layui-timeline-content layui-text">
                            <h3 class="layui-timeline-title">{{item.time}}</h3>
                            <!-- <textarea name="store-data-{{index}}" id="store-data-{{index}}"  class="layui-textarea"> </textarea> -->
                            <pre class="layui-code"> {{item.value}} </pre>      
                        </div>
                    </li>
                </ul>
                {{#  }); }}
                {{#  } }}
            </script>
                <div id="tl-ops-web-store-view"></div>
            </div>
        </div>
    </div>

    <script src="../tl_ops_web_comm.js"></script>
    <script>
        layui.use(['laytpl', 'layedit', 'code'], () => {
            window.$ = layui.$;
            window.form = layui.form;
            window.laytpl = layui.laytpl;
            window.layedit = layui.layedit;
            window.code = layui.code;

            let filename_args = tl_request_get_param("filename");
            let store = parent.window.localStorage.getItem(filename_args)
            store = JSON.parse(store);

            laytpl(document.getElementById("tl-ops-web-store-tpl").innerHTML).render((() => {
                for(let i = 0; i < store.list.length; i++){
                    store.list[i].value = JSON.stringify(store.list[i].value, null, "\t")
                }
                return store.list.sort(function(a, b){return new Date(b.time) - new Date(a.time)})
            })(), (html) => {
                document.getElementById("tl-ops-web-store-view").innerHTML = html;
            });
        });
    </script>
</body>

</html>